package cn.explink.dop.enums.pub;

import java.util.ArrayList;
import java.util.List;

/**
 * 是否
 *
 * @author firefly 2015-2-28 10:40
 *
 */
public enum YesNoEnum {

	YES(1, "是"), NO(2, "否");

	private int value;
	private String text;

	private YesNoEnum(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public int getValue() {
		return this.value;
	}

	public String getText() {
		return this.text;
	}

	public static List<YesNoEnum> getAllStatus() {
		List<YesNoEnum> yesNoEnumList = new ArrayList<YesNoEnum>();
		yesNoEnumList.add(YES);
		yesNoEnumList.add(NO);
		return yesNoEnumList;
	}

	public static String getTextByValue(int value) {
		List<YesNoEnum> allStatus = YesNoEnum.getAllStatus();
		for (YesNoEnum yesNoEnum : allStatus) {
			if (yesNoEnum.getValue() == value) {
				return yesNoEnum.getText();
			}
		}
		return "";
	}

}
